const express = require("express");
const app = express();

const bodyParser = require("body-parser");
const multer = require("multer");
const configRoutes = require("./routes");
const path = require("path");

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));

app.use(express.static(path.join(__dirname, "/public")));
app.set("view engine", "ejs"); 

//  change your rendering engine
//  By default Express' boilerplate will look for a file named layout in our views directory.

configRoutes(app);
/**
 * 相册服务器版
 * 1. 添加图片功能, 应把图片上传到服务器上
 * 2. 所有相册信息, 比如分类信息等等要保存到服务器端, 这样可以保证, 重新刷新浏览器, 也有数据。
 * 3. 增删图片时, 也会增删服务器端的图片文件.
 */

app.listen(3000, ()=> {
    console.log("We've got an express server!");
    console.log("We are listening on the 'http://localhost:3000'");
})
